import { Cluster } from '@solana/web3.js'

export type AmmConfig = {
  index: number
  id: string
  protocolFeeRate: number
  tradeFeeRate: number
  tickSpacing: number
  fundFeeRate: number
  fundOwner: string
  description?: string
  defaultRange: number
  defaultRangePoint: number[]
}

const mainnetAmmConfigs: Record<string, AmmConfig> = {
  HZzqEWHEvSiqYt6PxxLs7zXETmqGuryqfmvggjAkqisp: {
    id: 'HZzqEWHEvSiqYt6PxxLs7zXETmqGuryqfmvggjAkqisp',
    index: 0,
    protocolFeeRate: 120000,
    tradeFeeRate: 100,
    tickSpacing: 10,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  He4brjK7TRKiqJ8szpRmhuueDwC4837BFRRBmWfmjo14: {
    id: 'He4brjK7TRKiqJ8szpRmhuueDwC4837BFRRBmWfmjo14',
    index: 1,
    protocolFeeRate: 120000,
    tradeFeeRate: 2500,
    tickSpacing: 60,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  GUNzSDNbhcWpS6Ymj7kgyYmhgHimwfzpRdhJnbKDAi9K: {
    id: 'GUNzSDNbhcWpS6Ymj7kgyYmhgHimwfzpRdhJnbKDAi9K',
    index: 2,
    protocolFeeRate: 120000,
    tradeFeeRate: 500,
    tickSpacing: 10,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  EtgcyD5Yk6Kuqf1fahAjTrsRCDgoUmgeZ7xJDS3giaE: {
    id: 'EtgcyD5Yk6Kuqf1fahAjTrsRCDgoUmgeZ7xJDS3giaE',
    index: 3,
    protocolFeeRate: 120000,
    tradeFeeRate: 10000,
    tickSpacing: 120,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  EvKEMSRSdxJUcpVTaB2isqMyF5G4yETvMbQxbfwSuwZa: {
    id: 'EvKEMSRSdxJUcpVTaB2isqMyF5G4yETvMbQxbfwSuwZa',
    index: 4,
    protocolFeeRate: 120000,
    tradeFeeRate: 100,
    tickSpacing: 1,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.001,
    defaultRangePoint: [0.001, 0.003, 0.005, 0.008, 0.01],
  },
  '2cc6jRdZgmN7uG3PxbuVEkYwQNPS7qQinKYYCwG53cpr': {
    id: '2cc6jRdZgmN7uG3PxbuVEkYwQNPS7qQinKYYCwG53cpr',
    index: 5,
    protocolFeeRate: 120000,
    tradeFeeRate: 500,
    tickSpacing: 1,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  GcJVsj5MxokA4eRMUkB4cJHuZ6o9Y8MooXBViN5F1mYW: {
    id: 'GcJVsj5MxokA4eRMUkB4cJHuZ6o9Y8MooXBViN5F1mYW',
    index: 6,
    protocolFeeRate: 120000,
    tradeFeeRate: 200,
    tickSpacing: 1,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  '2zmg7259ahZkrSn6M3PEM7eFvEfBU8obgfVHT3AL9Qwu': {
    id: '2zmg7259ahZkrSn6M3PEM7eFvEfBU8obgfVHT3AL9Qwu',
    index: 7,
    protocolFeeRate: 120000,
    tradeFeeRate: 300,
    tickSpacing: 1,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  '5kosJrgZ6rHyqqweWGpp11nNqdwPTHbyXVczvzPM9h7M': {
    id: '5kosJrgZ6rHyqqweWGpp11nNqdwPTHbyXVczvzPM9h7M',
    index: 8,
    protocolFeeRate: 120000,
    tradeFeeRate: 400,
    tickSpacing: 1,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  '2W1ToXSAUDwRQtZdgCjgXmFfiSvPmGDPx3CijKpVKArw': {
    id: '2W1ToXSAUDwRQtZdgCjgXmFfiSvPmGDPx3CijKpVKArw',
    index: 9,
    protocolFeeRate: 120000,
    tradeFeeRate: 20000,
    tickSpacing: 120,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  '5szFcjKA7UU93nhgb3fE1o1cfcurwpFQEzywZyb2qAYF': {
    id: '5szFcjKA7UU93nhgb3fE1o1cfcurwpFQEzywZyb2qAYF',
    index: 10,
    protocolFeeRate: 120000,
    tradeFeeRate: 1000,
    tickSpacing: 10,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  J1SzfvdJ3p4ixWdyhoHmVpnixfjUBcEZiJ3M66JHGTKz: {
    id: 'J1SzfvdJ3p4ixWdyhoHmVpnixfjUBcEZiJ3M66JHGTKz',
    index: 11,
    protocolFeeRate: 120000,
    tradeFeeRate: 1500,
    tickSpacing: 10,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  '5B9wMiyqe7maHxAKACrTiGYwTeSX3ZmpmxRgALUMTcdZ': {
    id: '5B9wMiyqe7maHxAKACrTiGYwTeSX3ZmpmxRgALUMTcdZ',
    index: 12,
    protocolFeeRate: 120000,
    tradeFeeRate: 1600,
    tickSpacing: 10,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  '5tbvQTWV2btAgX5NwzCbd8aFwTfDWeCZANRQUcWuKRan': {
    id: '5tbvQTWV2btAgX5NwzCbd8aFwTfDWeCZANRQUcWuKRan',
    index: 13,
    protocolFeeRate: 120000,
    tradeFeeRate: 1800,
    tickSpacing: 10,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  G3BrCQzNu93v1acayMA23CmCMH8tf6iAFb3PYUHUHtcg: {
    id: 'G3BrCQzNu93v1acayMA23CmCMH8tf6iAFb3PYUHUHtcg',
    index: 14,
    protocolFeeRate: 120000,
    tradeFeeRate: 2000,
    tickSpacing: 10,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  '2G7HZiydoxtDqQU5SPsyc66nCGRUaP6H85FRKunKpmPs': {
    id: '2G7HZiydoxtDqQU5SPsyc66nCGRUaP6H85FRKunKpmPs',
    index: 15,
    protocolFeeRate: 120000,
    tradeFeeRate: 4000,
    tickSpacing: 60,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  A3qKMAUV2JsBUeRssKeLm2xJr9w9PKFNWGxPfSV6E7vu: {
    id: 'A3qKMAUV2JsBUeRssKeLm2xJr9w9PKFNWGxPfSV6E7vu',
    index: 16,
    protocolFeeRate: 120000,
    tradeFeeRate: 6000,
    tickSpacing: 60,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  GaWZjVasTQLCNmag5n34eyhhD4T56TN39ckNcuUmu7x4: {
    id: 'GaWZjVasTQLCNmag5n34eyhhD4T56TN39ckNcuUmu7x4',
    index: 17,
    protocolFeeRate: 120000,
    tradeFeeRate: 8000,
    tickSpacing: 60,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  '3EKNN4mNKSzBnfB5gC9q4eeL7WMWBrnuaoagMQVCL2vq': {
    id: '3EKNN4mNKSzBnfB5gC9q4eeL7WMWBrnuaoagMQVCL2vq',
    index: 18,
    protocolFeeRate: 120000,
    tradeFeeRate: 30000,
    tickSpacing: 120,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  GeNe8uDSMpCip17DmToci8XNhTgwJJ4QdXP3HNrZbA21: {
    id: 'GeNe8uDSMpCip17DmToci8XNhTgwJJ4QdXP3HNrZbA21',
    index: 19,
    protocolFeeRate: 120000,
    tradeFeeRate: 40000,
    tickSpacing: 120,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  '4LTiLQbjodjCy8dFWqgUx6fzQ93Pq37c5jWGX9jRsRtC': {
    id: '4LTiLQbjodjCy8dFWqgUx6fzQ93Pq37c5jWGX9jRsRtC',
    index: 20,
    protocolFeeRate: 160000,
    tradeFeeRate: 3000,
    tickSpacing: 60,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  '9rrh2c8w15HExZnLFzcEgkvHg846TBBFEPUuFG7RMGmm': {
    id: '9rrh2c8w15HExZnLFzcEgkvHg846TBBFEPUuFG7RMGmm',
    index: 21,
    protocolFeeRate: 160000,
    tradeFeeRate: 800,
    tickSpacing: 1,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
}

const devnetAmmConfigs: Record<string, AmmConfig> = {
  '5898eU3GB7uFn9eaLJNLMkjiUaHUNFcKHksLLUtEXeKV': {
    id: '5898eU3GB7uFn9eaLJNLMkjiUaHUNFcKHksLLUtEXeKV',
    index: 3,
    protocolFeeRate: 12,
    tradeFeeRate: 10000,
    tickSpacing: 200,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    description: 'Best for exotic pairs',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5, 0.6, 0.7, 0.8, 0.9],
  },
  AEWHer5AqGwYMLwNUmVG3jpLK5p7PBLZF7B2EPT4PfYG: {
    id: 'AEWHer5AqGwYMLwNUmVG3jpLK5p7PBLZF7B2EPT4PfYG',
    index: 2,
    protocolFeeRate: 12,
    tradeFeeRate: 3000,
    tickSpacing: 60,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    description: 'Best for most pairs',
    defaultRange: 0.1,
    defaultRangePoint: [0.01, 0.05, 0.1, 0.2, 0.5],
  },
  Bu65sZ3Kq7iTFDBTSsptD4LkxWCo1q5BDogZDmC7xoUT: {
    id: 'Bu65sZ3Kq7iTFDBTSsptD4LkxWCo1q5BDogZDmC7xoUT',
    index: 1,
    protocolFeeRate: 12,
    tradeFeeRate: 500,
    tickSpacing: 10,
    fundFeeRate: 0,
    fundOwner: 'DmwXqqK5Zuj619au6q2Jx3TMr9ZV1837uxJcEwyvXVtV',
    description: 'Best for stable pairs',
    defaultRange: 0.1,
    defaultRangePoint: [0.1, 0.2],
  },
}

export const ammConfigs: { [key in Cluster]?: Record<string, AmmConfig> } = {
  'mainnet-beta': mainnetAmmConfigs,
  devnet: devnetAmmConfigs,
}
